﻿@model Zor_Web.Models.Stat.V_Zor_LeaseHous
@using Webdiyer.WebControls.Mvc;
@{
    Layout = null;
}
@using Zor_Tools;

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>出租房屋表</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 表单验证 -->
    <script src="~/Content/Scripts/JValidator.js"></script>

</head>
<body class="gray-bg">
    <div class="layui-tab layui-tab-brief main-tab-container ">
        <div class="col-sm-12 ct-padding">
            <div class="col-sm-9 ct-padding">
                <button id="btnExport" class="layui-btn layui-btn-warm layui-btn-small"><span class="glyphicon glyphicon-share"></span> 导出</button>
                <button id="btnReplace" class="layui-btn layui-btn-danger layui-btn-small"><span class="glyphicon glyphicon-refresh"></span> 刷新</button>
                <button id="btnMessage" class="layui-btn layui-btn-danger layui-btn-small"><span class="glyphicon glyphicon-list-alt"></span> 详情</button>
            </div>
        </div>
        <div class="layui-tab-content">
            <table class="layui-table" lay-skin="line">
                <thead>
                    <tr>
                        <th><input type="checkbox" name="checkAll" id="cbkCheckAll"></th>
                        <th>楼宇(街道)</th>
                        <th>单元(门牌)</th>
                        <th>房间(商铺)</th>
                        <th>房屋(商铺)面积</th>
                        <th>业主姓名</th>
                        <th>业主电话</th>
                        <th>租户类别</th>
                        <th>租户名称</th>
                        <th>月租金</th>
                        <th>起租日期</th>
                        <th>截止日期</th>
                    </tr>
                </thead>
                <tbody id="accordion">
                    @foreach (var item in Model.PageData)
                    {
                        <tr>
                            <td><input type="checkbox" name="chk" id="@item.Hs_Id" value="@item.Hs_Id" /></td>
                            <td>@item.Bd_Name</td>
                            <td>@item.Uim_Name</td>
                            <td>@item.Hs_Number</td>
                            <td>@item.Hs_Proportion</td>
                            <td>@item.NatPer_Name</td>
                            <td>@item.NatPer_Phone</td>
                            <td>@item.TenantType</td>
                            <td>@item.Tenant_Name</td>
                            <td>@(item.Lease_Rent*0.01)</td>
                            <td>@TimeHelper.TimeStampToDateTime(item.Lease_CreateTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td>@TimeHelper.TimeStampToDateTime(item.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@item.Hsattribute</td>
                            <td hidden>@item.NatPer_IDNumber</td>
                            <td hidden>@item.Tenant_Code</td>
                            <td hidden>@item.Tenant_TaxRegistrationNum</td>
                            <td hidden>@item.Tenant_LegalPerson</td>
                            <td hidden>@item.Tenant_Phone</td>
                            <td hidden>@item.Tenant_TaxAuthority</td>
                            <td hidden>@item.Tenant_IDNumber</td>
                            <td hidden>@item.LeaseType</td>
                        </tr>
                    }

                </tbody>
            </table>
            <div class="col-sm-12">
                <div class="col-sm-10">
                    @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
                </div>
                <div class="col-sm-2 to-righjt">
                    共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
                </div>
            </div>
        </div>
    </div>

    <!-- 导出模态 -->
    <form action="/Stat/ExportLeaseHous" enctype="multipart/form-data" method="post" id="formDownload">
        <div id="exportHtml" style="display:none;">
            <div class="eh_wrap">
                <div class="eh_head">
                    <p style="">请选择您要导出的数据列</p>
                </div>
                <table width="100%" cellpadding="5" cellspacing="0">
                    <tr>
                        <td><input id="Bd_Name" type="checkbox" value="楼宇" name="chk_list" checked="checked" /><label>楼宇</label></td>
                        <td><input id="Uim_Name" type="checkbox" value="单元" name="chk_list" checked="checked" /><label>单元</label></td>
                        <td><input id="Hs_Number" type="checkbox" value="房间" name="chk_list" checked="checked" /><label>房间</label></td>
                        <td><input id="Hs_Proportion" type="checkbox" value="房屋面积" name="chk_list" checked="checked" /><label>房屋面积</label></td>
                        <td><input id="NatPer_Name" type="checkbox" value="业主姓名" name="chk_list" checked="checked" /><label>业主姓名</label></td>
                        <td><input id="NatPer_Phone" type="checkbox" value="业主电话" name="chk_list" checked="checked" /><label>业主电话</label></td>
                    </tr>
                    <tr>

                        <td><input id="TenantType" type="checkbox" value="租户类别" name="chk_list" checked="checked" /><label>租户类别</label></td>
                        <td><input id="Tenant_Name" type="checkbox" value="租户名称" name="chk_list" checked="checked" /><label>租户名称</label></td>
                        <td><input id="Lease_Rent" type="checkbox" value="月租金" name="chk_list" checked="checked" /><label>月租金</label></td>
                        <td><input id="Lease_StartTime" type="checkbox" value="起租日期" name="chk_list" checked="checked" /><label>起租日期</label></td>
                        <td><input id="Lease_EndTime" type="checkbox" value="截止日期" name="chk_list" checked="checked" /><label>截止日期</label></td>
                    </tr>
                </table>
            </div>
            <div class="box-footer">
                <button type="submit" id="btnExportSure" class="btn btn-info pull-right">
                    <i class="fa fa-repeat"></i>导出
                </button>
                <input type="hidden" id="fields" name="fields" value="" />
                <input type="hidden" id="where" name="where" value="" />
            </div>
        </div>
    </form>

    <!-- 详情模态 -->
    <div id="myModalMessage" hidden data-backdrop="static">
        <div id="divfrom" class="layui-tab-content">
            <form class="form-horizontal m-t">
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">业主姓名：</label>
                                <div class="col-sm-4">
                                    <input id="NatPer_Name1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>

                                <label class="col-sm-2 layui-form-label">身份证号：</label>
                                <div class="col-sm-4">
                                    <input id="NatPer_IDNumber1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
           
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">联系电话：</label>
                                <div class="col-sm-4">
                                    <input id="NatPer_Phone1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">房屋面积：</label>
                                <div class="col-sm-4">
                                    <input id="Hs_Proportion1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                          
                            <div class="hr-line-dashed"></div>
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">房屋性质：</label>
                                <div class="col-sm-4">
                                    <input id="HsNature1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">月租金：</label>
                                <div class="col-sm-4">
                                    <input id="Lease_Rent1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                        
                            <div class="hr-line-dashed"></div>
               
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">租户类别：</label>
                                <div class="col-sm-4">
                                    <input id="TenantType1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">起租日期：</label>
                                <div class="col-sm-4">
                                    <input id="Lease_CreateTime1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                       
                            <div class="hr-line-dashed"></div>
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">截止日期：</label>
                                <div class="col-sm-4">
                                    <input id="Lease_EndTime1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">单位名称/姓名：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_Name1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                         
                            <div class="hr-line-dashed"></div>
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">管理代码：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_Code1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">税务登记号：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_TaxRegistrationNum1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                  
                            <div class="hr-line-dashed"></div>
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">管理代码：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_Code1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">法人：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_LegalPerson1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                 
                            <div class="hr-line-dashed"></div>
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">联系电话：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_Phone1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                                <label class="col-sm-2 layui-form-label">税务机关：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_TaxAuthority1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                   
                            <div class="hr-line-dashed"></div>
                            <div class="layui-form-item">
                                <label class="col-sm-2 layui-form-label">租户身份证号：</label>
                                <div class="col-sm-4">
                                    <input id="Tenant_IDNumber1" readonly type="text" class="form-control" autofocus="autofocus">
                                </div>
                            </div>
                        </form>

                    </div>
                </div>

    <script type="text/javascript">
        $(function () {

            /*模态关闭后回调用*/
            $('#myModal').on('hidden.bs.modal', function (e) {
                Replace();
            });
            /*刷新*/
            $("#btnReplace").click(function () {
                Replace();
            });
            /* 全选 */
            $(function () {
                $("#cbkCheckAll").click(function () {
                    if (this.checked) {
                        $("input[name='chk']").prop('checked', true);
                    } else {
                        $("input[name='chk']").prop('checked', false);
                    }
                })
            })
            /*导出*/
            $("#btnExport").click(function () {
                layer.open({
                    type: 1,
                    title: '导出提示',
                    shade: false,
                    skin: 'layui-layer-rim',
                    area: ['620px', '235px'], //宽高
                    content: $('#exportHtml')
                });
            });
            /*导出交互*/
            $("#btnExportSure").click(function () {
                var arr = new Array();
                $("[name='chk_list']").each(function () {
                    if ($(this).is(":checked")) {
                        arr.push($(this).attr("id") + "|" + $(this).val());
                    }
                });
                $("#fields").val(arr);
                document.getElementById('formDownload').submit();
                layer.closeAll();
            });
            /*详情*/
            $("#btnMessage").click(function () {
                var checkId = CheckboxValueIDs();
                $("#lbltitle").text("个人租户详情");
                if (checkId.length == 0) {
                    layer.msg("请选择要查看的信息！");
                    $("#myModalDetails").attr("ID", "test");
                    return;
                }
                if (checkId.length > 1) {
                    layer.msg("仅可选择一行信息查看！");
                    $("#myModalDetails").attr("ID", "test");
                    return;
                }
                $("#test").attr("ID", "myModalDetails");
                $("#Bd_Name1").val(getTableCell(1));
                $("#Uim_Name1").val(getTableCell(2));
                $("#Hs_Number1").val(getTableCell(3));
                $("#Hs_Proportion1").val(getTableCell(4));
                $("#NatPer_Name1").val(getTableCell(5));
                $("#NatPer_Phone1").val(getTableCell(6));
                $("#TenantType1").val(getTableCell(7));
                $("#Tenant_Name1").val(getTableCell(8));
                $("#Lease_Rent1").val(getTableCell(9));
                $("#Lease_CreateTime1").val(getTableCell(10));
                $("#Lease_EndTime1").val(getTableCell(11));
                $("#HsNature1").val(getTableCell(12));
                $("#NatPer_IDNumber1").val(getTableCell(13));
                $("#Tenant_Code1").val(getTableCell(14));
                $("#Tenant_TaxRegistrationNum1").val(getTableCell(15));
                $("#Tenant_LegalPerson1").val(getTableCell(16));
                $("#Tenant_Phone1").val(getTableCell(17));
                $("#Tenant_TaxAuthority1").val(getTableCell(18));
                $("#Tenant_IDNumber1").val(getTableCell(19));
                $("#LeaseType1").val(getTableCell(20));
                LayerOpen('800px', '490px', '出租房屋详情', $('#myModalMessage'));
            });

        });
    </script>
</body>
</html>












                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
                                            
